package com.example.campusproject.slice;

import com.example.campusproject.ResourceTable;
import ohos.aafwk.ability.AbilitySlice;
import ohos.aafwk.content.Intent;
import ohos.agp.components.Component;
import ohos.agp.components.Text;
import ohos.agp.window.dialog.ToastDialog;

public class CXZNAbilitySlice extends AbilitySlice {
    private Text tv_wdwz,tv_xlcx,tv_wzcx,tv_fh;
    @Override
    protected void onStart(Intent intent) {
        super.onStart(intent);
        this.setUIContent(ResourceTable.Layout_ability_cxzn);
        //我的位置
        tv_wdwz= (Text) this.findComponentById(ResourceTable.Id_tv_wdwz);
        //线路查询
        tv_xlcx= (Text) this.findComponentById(ResourceTable.Id_tv_xlcx);
        //位置查询
        tv_wzcx= (Text) this.findComponentById(ResourceTable.Id_tv_wzcx);
        //返回
        tv_fh= (Text) this.findComponentById(ResourceTable.Id_tv_fh);

        tv_fh.setClickedListener(new Component.ClickedListener() {
            @Override
            public void onClick(Component component) {
                //销毁当前界面，返回上一个界面
                terminate();
            }
        });
        tv_wdwz.setClickedListener(listener->present(new MyPositionAbilitySlice(),new Intent()));
        tv_xlcx.setClickedListener(listener->present(new PathSelectAilitySlice(),new Intent()));
        tv_wzcx.setClickedListener(listener->present(new PositionSelectAbilitySlice(),new Intent()));
    }
}
